package com.travel.sight.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.travel.sight.entity.ClickEntity;
import com.travel.sight.service.ClickService;
import com.travel.common.utils.PageUtils;
import com.travel.common.utils.R;



/**
 * 
 *
 * @author lxw
 * @email lxw@gmail.com
 * @date 2023-11-01 17:41:24
 */
@RestController
@RequestMapping("sight/click")
public class ClickController {
    @Autowired
    private ClickService clickService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("sight:click:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = clickService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{clickId}")
    //@RequiresPermissions("sight:click:info")
    public R info(@PathVariable("clickId") Integer clickId){
		ClickEntity click = clickService.getById(clickId);

        return R.ok().put("click", click);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("sight:click:save")
    public R save(@RequestBody ClickEntity click){
		clickService.save(click);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("sight:click:update")
    public R update(@RequestBody ClickEntity click){
		clickService.updateById(click);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("sight:click:delete")
    public R delete(@RequestBody Integer[] clickIds){
		clickService.removeByIds(Arrays.asList(clickIds));

        return R.ok();
    }

}
